var jQuery = jQuery.noConflict();   
jQuery(document).ready(function() {
	jQuery("#myprice").keyup(function() {
		myprice = jQuery("#myprice").val();
		discuz = jQuery("#discuz").val();
		discuzpay = jQuery("#p_discuzpay").text();
		freepay = jQuery("#p_freepay").text();
		myprice = parseInt(myprice);
		freepay = parseInt(freepay);
		discuzpay = parseInt(discuzpay);
		if(myprice >= freepay) {
			dxpay = (myprice * discuzpay) / 100;
			if(discuz == 's') {
				sellerprice = myprice - dxpay;
				buyerprice = myprice;
			} else if(discuz == 'b') {
				buyerprice = myprice + dxpay;
				sellerprice = myprice;
			}
		} else {
			sellerprice = myprice;
			buyerprice = myprice;
		}
		jQuery("#buyerprice").html("<b color='red'>"+buyerprice+"?</b>");
		jQuery("#sellerprice").html("<b color='blue'>"+sellerprice+"?</b>");
	});
	jQuery("#discuz").change(function() {
		myprice = jQuery("#myprice").val();
		discuz = jQuery("#discuz").val();
		discuzpay = jQuery("#p_discuzpay").text();
		freepay = jQuery("#p_freepay").text();
		myprice = parseInt(myprice);
		freepay = parseInt(freepay);
		discuzpay = parseInt(discuzpay);
		if(myprice >= freepay) {
			dxpay = (myprice * discuzpay) / 100;
			if(discuz == 's') {
				sellerprice = myprice - dxpay;
				buyerprice = myprice;
			} else if(discuz == 'b') {
				buyerprice = myprice + dxpay;
				sellerprice = myprice;
			}
		} else {
			sellerprice = myprice;
			buyerprice = myprice;
		}
		jQuery("#buyerprice").html("<b color='red'>"+buyerprice+"Ԫ</b>");
		jQuery("#sellerprice").html("<b color='blue'>"+sellerprice+"Ԫ</b>");
	});
	jQuery("#myprice_c").keyup(function() {
		myprice = jQuery("#myprice_c").val();
		discuz = jQuery("#discuz_c").val();
		discuzpay = jQuery("#p_discuzpay").text();
		freepay = jQuery("#p_freepay").text();
		myprice = parseInt(myprice);
		freepay = parseInt(freepay);
		discuzpay = parseInt(discuzpay);
		if(myprice >= freepay) {
			dxpay = (myprice * discuzpay) / 100;
			if(discuz == 's') {
				sellerprice = myprice - dxpay;
				buyerprice = myprice;
			} else if(discuz == 'b') {
				buyerprice = myprice + dxpay;
				sellerprice = myprice;
			}
		} else {
			sellerprice = myprice;
			buyerprice = myprice;
		}
		jQuery("#buyerprice_c").html("<b color='red'>"+buyerprice+"Ԫ</b>");
		jQuery("#sellerprice_c").html("<b color='blue'>"+sellerprice+"Ԫ</b>");
	});
	jQuery("#discuz_c").change(function() {
		myprice = jQuery("#myprice_c").val();
		discuz = jQuery("#discuz_c").val();
		discuzpay = jQuery("#p_discuzpay").text();
		freepay = jQuery("#p_freepay").text();
		myprice = parseInt(myprice);
		freepay = parseInt(freepay);
		discuzpay = parseInt(discuzpay);
		if(myprice >= freepay) {
			dxpay = (myprice * discuzpay) / 100;
			if(discuz == 's') {
				sellerprice = myprice - dxpay;
				buyerprice = myprice;
			} else if(discuz == 'b') {
				buyerprice = myprice + dxpay;
				sellerprice = myprice;
			}
		} else {
			sellerprice = myprice;
			buyerprice = myprice;
		}
		jQuery("#buyerprice_c").html("<b color='red'>"+buyerprice+"Ԫ</b>");
		jQuery("#sellerprice_c").html("<b color='blue'>"+sellerprice+"Ԫ</b>");
	});
});